UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dSdFFu2PsBvCod0InrV4L+hZ1KqO9Zm0+K3eJ6R0suc=' 
WHERE 
  key_id = 'd452e7752ac3b29ad66ad705ff7dc809308731152046015e7cf4ef96a7a3944e' 
  AND (
    token = 'dSdFFu2PsBvCod0InrV4L+hZ1KqO9Zm0+K3eJ6R0suc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038