UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm4zuLpjlcnKA+KRz6T3WM5j2meI1R1ISqyPg3o7H0I0=' 
WHERE 
  key_id = 'ba3fcb315481760f12c5f5633538c7abe082dd22abaff49bd66e5236a4b03bdb' 
  AND (
    token = 'm4zuLpjlcnKA+KRz6T3WM5j2meI1R1ISqyPg3o7H0I0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031