UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IWSaCgQl94mxbjiByHW1QT/vKz20ggTFN12w19lC9bs=' 
WHERE 
  key_id = 'a59c07459537bcfb8ebfc200a5e0f0cea4fc39d5928210885de5c71e27a0ac94' 
  AND (
    token = 'IWSaCgQl94mxbjiByHW1QT/vKz20ggTFN12w19lC9bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039