UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xpt4ED1/IfZesmt67tEaiXeJ+WMXj37FHe53Y3WvLY8=' 
WHERE 
  key_id = '4a342b58fa71290c54cdf3c16776a5f955301b9193cda4baee2686513f62c9e0' 
  AND (
    token = 'Xpt4ED1/IfZesmt67tEaiXeJ+WMXj37FHe53Y3WvLY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027